﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace cjwygl
{
    public partial class FrmMonthSel : Form
    {
        public FrmMonthSel()
        {
            InitializeComponent();
        }

        private void button_ok_Click(object sender, EventArgs e)
        {
            Dispose();
            FrmPrint frmPrint = new FrmPrint(comboBox_genMonth.SelectedItem.ToString(), comboBox_paid.SelectedIndex);
            frmPrint.ShowDialog();
        }

        private void button_cancel_Click(object sender, EventArgs e)
        {
            Dispose();
        }

        private void FrmMonthSel_Load(object sender, EventArgs e)
        {
            comboBox_paid.SelectedIndex = 0;
            comboBox_genMonth.Items.Add("<全部>");
            using (DataBase db = new DataBase())
            {
                string sql = "SELECT DISTINCT GEN_MONTH FROM CJ_MAIN_FEE order by GEN_MONTH";
                DataTable dt = db.ExecuteDataTable(sql);
                foreach (DataRow dr in dt.Rows)
                {
                    comboBox_genMonth.Items.Add(dr[0].ToString());
                }
            }
            comboBox_genMonth.SelectedItem = DateTime.Now.ToString("yyyyMM");
        }
    }
}
